Skip to content

fix(db): reject application models in migrations - #625

Open
Guflly wants to merge 3 commits into
cot-rs:masterfrom
Guflly:fix/migration-model-guard
Open

fix(db): reject application models in migrations#625
Guflly wants to merge 3 commits into
cot-rs:masterfrom
Guflly:fix/migration-model-guard

Conversation

@Guflly

@Guflly Guflly commented Jul 27, 2026

Copy link
Copy Markdown

Fixes #623. Custom migrations now reject application models before they can access the database. Migration models and raw SQL keep working. Tested with the full cot suite, the macro suite, and clippy.

@github-actions github-actions Bot added C-lib Crate: cot (main library crate) C-macros Crate: cot-macros labels Jul 27, 2026
@Guflly
Guflly marked this pull request as ready for review July 27, 2026 18:40
Comment thread cot/src/db.rs Outdated
Comment thread cot/src/db.rs Outdated
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.87097% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cot/src/db.rs 75.00% 0 Missing and 7 partials ⚠️
cot/src/db/migrations.rs 90.62% 1 Missing and 2 partials ⚠️
Flag Coverage Δ
rust 90.28% <83.87%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cot-macros/src/model.rs 96.42% <100.00%> (+0.06%) ⬆️
cot/src/db/migrations.rs 83.87% <90.62%> (+0.40%) ⬆️
cot/src/db.rs 87.70% <75.00%> (-0.50%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Guflly

Guflly commented Jul 27, 2026

Copy link
Copy Markdown
Author

Updated both. Database now uses DatabaseContext, and models expose a public non-exhaustive ModelType. The Cot and macro test suites and clippy pass.

Comment thread cot/src/db.rs

@seqre seqre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution and from my side it seems fine! I'll leave the final call to @m4tx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-lib Crate: cot (main library crate) C-macros Crate: cot-macros

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Usage of regular models in custom migrations should not be allowed

3 participants